﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WpfApp.Entity;

namespace WpfApp
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            //Thre
        }
        private void btn_Click(object sender, RoutedEventArgs e)
        {
            //创建一个双精度动画
            DoubleAnimation animation = new DoubleAnimation();
            animation.From = btn.Width;//设置动画初始值
            animation.To = btn.Width-30;//设置动画的结束值
            animation.Duration = TimeSpan.FromSeconds(2);//设置动画的持续时间

            btn.BeginAnimation(Button.WidthProperty,animation);//(被修改值，执行的动画)
        }
    }
}
